// SETUP
//Load the ending scene

#include ladyluckbiggraphics.txt

setdatapath("data/graphics/cutscenes/endgame/scene_1/");

addbackground("intro", {sprites: ["background.png"]});

var ladyluckgraphics = {
	talking: {
		animation: "ladyluck_talking.json",
		pack: "pack.pck",
		speed: 3,
		loop: true
	},
	idle: {
		animation: "ladyluck_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}

var warriorgraphics = {
	talking: {
		animation: "warrior_talking.json",
		pack: "pack.pck",
		speed: 1,
		loop: true
	},
	idle: {
		animation: "warrior_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}

var thiefgraphics = {
  /* Thief doesn't speak here
	talking: {
		animation: "thief_talking.json",
		pack: "pack.pck",
		speed: 1,
		loop: true
	},*/
	idle: {
		animation: "thief_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}

var robotgraphics = {
  /* Robot doesn't speak here
	talking: {
		animation: "robot_talking.json",
		pack: "pack.pck",
		speed: 1,
		loop: true
	},*/
	idle: {
		animation: "robot_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}


var inventorgraphics = {
	talking: {
		animation: "inventor_talking.json",
		pack: "pack.pck",
		speed: 1,
		loop: true
	},
	idle: {
		animation: "inventor_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}

var witchgraphics = {
	talking: {
		animation: "witch_talking.json",
		pack: "pack.pck",
		speed: 1,
		loop: true
	},
	idle: {
		animation: "witch_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}

var jestergraphics = {
	talking: {
		animation: "jester_talking.json",
		pack: "pack.pck",
		speed: 1,
		loop: true
	},
	idle: {
		animation: "jester_talking.json",
		pack: "pack.pck",
		speed: 0,
		loop: false
	}
}

var ladyluck = addsprite("ladyluck", 1, ladyluckgraphics);
var warrior = addsprite("warrior", 1, warriorgraphics);
var thief = addsprite("thief", 1, thiefgraphics);
var robot = addsprite("robot", 1, robotgraphics);
var inventor = addsprite("inventor", 1, inventorgraphics);
var witch = addsprite("witch", 1, witchgraphics);
var jester = addsprite("jester", 1, jestergraphics);

play("music_cutscene_cheery");
changebackground("equipment_gameshow");

ladyluck_big.show("idle");
Actuate.tween(ladyluck_big, 1, { x: 0 }).ease(Sine.easeOut);

fadein();

wait(1);

ladyluck_big.show("talking");
actor("Lady Luck", screenwidthmid - 100, screenheightmid + 200, Col.YELLOW, LEFT, BOTTOM, "chat_ladyluck", "characters/misc/charicon_ladyluck");
speak("Lady Luck", "Welcome back to Dicey Dungeons!", "normal");
speak("Lady Luck", "Today we'll be watching a rerun of an|old fan favourite...");
speak("Lady Luck", "...the one where the dice buddies got together with|all the minions, and worked together to beat me!");
speak("Lady Luck", "I'm so proud I think I might be crying!", "normal");
ladyluck_big.show("idle");

fadeout();

while(isfading()) {
	// do nothing
}

changebackground("intro");
ladyluck.show("idle");
warrior.show("idle");
thief.show("idle");
robot.show("idle");
inventor.show("idle");
witch.show("idle");
jester.show("idle");
ladyluck_big.hide();

play("stopallmusic");
wait(0.5);
play("music_cutscene_dark");
changebackground("intro");

fadein();

actor("Warrior", 1950, screenheight - 500, Col.LIGHTBLUE, CENTER, BOTTOM, "chat_warrior", "characters/warrior/charicon_warrior");
actor("Thief", 150, screenheight - 400, Col.multiplylightness(Col.GREEN, 1.25), CENTER, BOTTOM, "chat_thief", "characters/thief/charicon_thief");
actor("Robot", 150, screenheight - 400, 0xDDDDDD, CENTER, BOTTOM, "chat_robot", "characters/robot/charicon_robot");
actor("Inventor", 1650, screenheight - 500, 0xffe48d, CENTER, BOTTOM, "chat_inventor", "characters/inventor/charicon_inventor");
actor("Witch", 2700, screenheight - 700, 0xb496ec, CENTER, BOTTOM, "chat_witch", "characters/witch/charicon_witch");
actor("Jester", 900, screenheight - 650, Col.multiplylightness(Col.RED, 1.25), CENTER, BOTTOM, "chat_jester", "characters/jester/charicon_jester");

wait(0.5);

ladyluck.show("talking");
actor("Lady Luck", screenwidthmid + 400, 150, Col.YELLOW, LEFT, TOP, "chat_ladyluck", "characters/misc/charicon_ladyluck");
speak("Lady Luck", "Well, hello, my doomed little dicelings!", "scary");
ladyluck.show("idle");

jester.show("talking");
speak("Jester", "Oh no...", "worried");
jester.show("idle");

ladyluck.show("talking");
actor("Lady Luck", screenwidthmid + 300, 150, Col.YELLOW, LEFT, TOP, "chat_ladyluck", "characters/misc/charicon_ladyluck");
speak("Lady Luck", "Oh yes! Now, what are you doing backstage?", "scary");
speak("Lady Luck", "Ready to give up on your dreams and|go into minion training?");
ladyluck.show("idle");

warrior.show("talking");
speak("Warrior", "We’re leaving! And you|can’t stop us.", "determined");
warrior.show("idle");

jester.show("talking");
speak("Jester", "She totally can, sorry.", "worried");
jester.show("idle");

ladyluck.show("talking");
speak("Lady Luck", "...Yeah, I definitely can.", "scary");
speak("Lady Luck", "Or haven’t you been paying attention?");
ladyluck.show("idle");

inventor.show("talking");
speak("Inventor", "We’ve been paying a|LOT of attention.", "determined");
speak("Inventor", "We’ve fought through|your dungeons.");
speak("Inventor", "We’ve beaten your bosses.");
//speak("Inventor", "We’ve won EVERY SINGLE EPISODE!");
speak("Inventor", "And yet we're still trapped down here thanks|to your rigged WHEEL OF LIES!", "action");
speak("Inventor", "You’re a cheat and this game ISN’T FAIR|so we’re going home!");
inventor.show("idle");

fadeout();
while(isfading()) {
	// do nothing
}

changebackground("equipment_boss");
ladyluck.hide();
warrior.hide();
thief.hide();
robot.hide();
inventor.hide();
witch.hide();
jester.hide();

ladyluck_big.x = -screenwidth;

fadein();

ladyluck_big.show("idlescary");
Actuate.tween(ladyluck_big, 1, { x: 0 }).ease(Sine.easeOut);
wait(1);

ladyluck_big.show("talkingscary");
actor("Lady Luck", screenwidthmid - 100, screenheightmid + 200, Col.YELLOW, LEFT, BOTTOM, "chat_ladyluck", "characters/misc/charicon_ladyluck");
speak("Lady Luck", "MINIONS! THE DOORS! ENTER LOCKDOWN!", "angry");
ladyluck_big.show("idlescary");

fadeout();
while(isfading()) {
	// do nothing
}

changebackground("intro");
ladyluck_big.hide();
ladyluck.show("idle");
warrior.show("idle");
thief.show("idle");
robot.show("idle");
inventor.show("idle");
witch.show("idle");
jester.show("idle");

fadein();

wait(0.25);

jester.show("talking");
speak("Jester", "Once the doors are locked, that’s it, we’re|stuck backstage until we give up.", "worried");
speak("Jester", "I’m really sorry, friends. But|at least we tried.");
jester.show("idle");

witch.show("talking");
speak("Witch", "No! I’m not giving up!", "worried");
speak("Witch", "And I’m not going to stay|BACKSTAGE for ever!");
speak("Witch", "Quick, can anyone make it through|the last door before it closes?");
witch.show("idle");

play("stopallmusic");
play("music_cutscene_finale");
startfinaleepisode();